class Solution(object):
    def permute(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        result = []
        nums_len = len(nums)
        if nums_len <= 1:
            return [nums]
        for i in range(nums_len):
            num = nums[i]
            res = nums[:i] + nums[i+1:]
            subs = self.permute(res)
            for sub in subs:
                tmp = [num] + sub
                result.append(tmp)
        return result
